{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "from pyspark import SparkContext\n",
    "from pyspark.sql import SparkSession\n",
    "sc=SparkContext(appName=\"hdfs_dataframe\")          #初始化SparkContext \n",
    "spark=SparkSession.builder.appName('hdfs_dataframe').master(\"Yct201811021847\").getOrCreate()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "movies_df=spark.read.csv('data/movies.csv',header=True, inferSchema=True).dropna()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "ratings_df=spark.read.csv('data/ratings.csv',header=True,inferSchema=True).dropna()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "root\n",
      " |-- userId: integer (nullable = true)\n",
      " |-- movieId: integer (nullable = true)\n",
      " |-- rating: double (nullable = true)\n",
      " |-- timestamp: integer (nullable = true)\n",
      "\n",
      "root\n",
      " |-- movieId: integer (nullable = true)\n",
      " |-- title: string (nullable = true)\n",
      " |-- genres: string (nullable = true)\n",
      "\n"
     ]
    }
   ],
   "source": [
    "ratings_df.printSchema()\n",
    "movies_df.printSchema()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "movies_df.createOrReplaceTempView('movies')      # 创建movies视图\n",
    "ratings_df.createOrReplaceTempView('ratings')       # 创建ratings视图"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "spark.sql(\"SELECT * FROM ratings\")\n",
    "spark.sql(\"SELECT * FROM movies\")\n",
    "rank_data=spark.sql(\" SELECT title , rating , userID, genres ,avg_movie_rating , \\\n",
    "        DENSE_RANK() OVER( ORDER BY avg_movie_rating desc) rank FROM \\\n",
    "    (SELECT m.title , rating , userID, m.genres, \\\n",
    "    AVG(rating) OVER(partition by m.movieId) avg_movie_rating \\\n",
    "    FROM  movies m LEFT JOIN ratings r ON r.movieId = m.movieId \\\n",
    "    WHERE rating is not null ) A \")#.filter('avg_movie_rating is not null')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "+--------------------+------+------+------+----------------+----+\n",
      "|               title|rating|userID|genres|avg_movie_rating|rank|\n",
      "+--------------------+------+------+------+----------------+----+\n",
      "|Trial, The (Procè...|   5.0|    59| Drama|             4.9|   2|\n",
      "|Trial, The (Procè...|   5.0|   156| Drama|             4.9|   2|\n",
      "|Trial, The (Procè...|   4.5|   330| Drama|             4.9|   2|\n",
      "|Trial, The (Procè...|   5.0|   410| Drama|             4.9|   2|\n",
      "|Trial, The (Procè...|   5.0|   469| Drama|             4.9|   2|\n",
      "+--------------------+------+------+------+----------------+----+\n",
      "\n"
     ]
    }
   ],
   "source": [
    "rank_data.filter('rank =2 ').show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "top5_rank=rank_data.filter('rank < 5')   #提取排名前10的"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "+--------------------+------+------+--------------------+----------------+----+\n",
      "|               title|rating|userID|              genres|avg_movie_rating|rank|\n",
      "+--------------------+------+------+--------------------+----------------+----+\n",
      "|Awfully Big Adven...|   5.0|   191|               Drama|             5.0|   1|\n",
      "|What Happened Was...|   5.0|   191|Comedy|Drama|Roma...|             5.0|   1|\n",
      "|Strictly Sexual (...|   5.0|    68|Comedy|Drama|Romance|             5.0|   1|\n",
      "| The Love Bug (1997)|   5.0|    89|Adventure|Childre...|             5.0|   1|\n",
      "|Raise Your Voice ...|   5.0|   175|             Romance|             5.0|   1|\n",
      "|One I Love, The (...|   5.0|   598|Comedy|Drama|Romance|             5.0|   1|\n",
      "|   The Editor (2015)|   5.0|    89|Comedy|Horror|Mys...|             5.0|   1|\n",
      "|Tenchi Muyô! In L...|   5.0|    89|    Animation|Comedy|             5.0|   1|\n",
      "|Martin Lawrence L...|   5.0|   553|  Comedy|Documentary|             5.0|   1|\n",
      "|Who Killed Chea V...|   5.0|   462|         Documentary|             5.0|   1|\n",
      "+--------------------+------+------+--------------------+----------------+----+\n",
      "only showing top 10 rows\n",
      "\n"
     ]
    }
   ],
   "source": [
    "top5_rank.show(10)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [],
   "source": [
    "pd_rank=top5_rank.toPandas()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>title</th>\n",
       "      <th>rating</th>\n",
       "      <th>userID</th>\n",
       "      <th>genres</th>\n",
       "      <th>avg_movie_rating</th>\n",
       "      <th>rank</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Awfully Big Adventure, An (1995)</td>\n",
       "      <td>5.0</td>\n",
       "      <td>191</td>\n",
       "      <td>Drama</td>\n",
       "      <td>5.00</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>What Happened Was... (1994)</td>\n",
       "      <td>5.0</td>\n",
       "      <td>191</td>\n",
       "      <td>Comedy|Drama|Romance|Thriller</td>\n",
       "      <td>5.00</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Strictly Sexual (2008)</td>\n",
       "      <td>5.0</td>\n",
       "      <td>68</td>\n",
       "      <td>Comedy|Drama|Romance</td>\n",
       "      <td>5.00</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>The Love Bug (1997)</td>\n",
       "      <td>5.0</td>\n",
       "      <td>89</td>\n",
       "      <td>Adventure|Children|Comedy|Fantasy</td>\n",
       "      <td>5.00</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>Raise Your Voice (2004)</td>\n",
       "      <td>5.0</td>\n",
       "      <td>175</td>\n",
       "      <td>Romance</td>\n",
       "      <td>5.00</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>One I Love, The (2014)</td>\n",
       "      <td>5.0</td>\n",
       "      <td>598</td>\n",
       "      <td>Comedy|Drama|Romance</td>\n",
       "      <td>5.00</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>The Editor (2015)</td>\n",
       "      <td>5.0</td>\n",
       "      <td>89</td>\n",
       "      <td>Comedy|Horror|Mystery</td>\n",
       "      <td>5.00</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>Tenchi Muyô! In Love (1996)</td>\n",
       "      <td>5.0</td>\n",
       "      <td>89</td>\n",
       "      <td>Animation|Comedy</td>\n",
       "      <td>5.00</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>Martin Lawrence Live: Runteldat (2002)</td>\n",
       "      <td>5.0</td>\n",
       "      <td>553</td>\n",
       "      <td>Comedy|Documentary</td>\n",
       "      <td>5.00</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>Who Killed Chea Vichea? (2010)</td>\n",
       "      <td>5.0</td>\n",
       "      <td>462</td>\n",
       "      <td>Documentary</td>\n",
       "      <td>5.00</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>Empties (2007)</td>\n",
       "      <td>5.0</td>\n",
       "      <td>105</td>\n",
       "      <td>Comedy</td>\n",
       "      <td>5.00</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>Lamerica (1994)</td>\n",
       "      <td>5.0</td>\n",
       "      <td>85</td>\n",
       "      <td>Adventure|Drama</td>\n",
       "      <td>5.00</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>Lamerica (1994)</td>\n",
       "      <td>5.0</td>\n",
       "      <td>603</td>\n",
       "      <td>Adventure|Drama</td>\n",
       "      <td>5.00</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>Passenger, The (Professione: reporter) (1975)</td>\n",
       "      <td>5.0</td>\n",
       "      <td>74</td>\n",
       "      <td>Drama</td>\n",
       "      <td>5.00</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>Tales of Manhattan (1942)</td>\n",
       "      <td>5.0</td>\n",
       "      <td>89</td>\n",
       "      <td>Comedy|Drama</td>\n",
       "      <td>5.00</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>Denise Calls Up (1995)</td>\n",
       "      <td>5.0</td>\n",
       "      <td>555</td>\n",
       "      <td>Comedy</td>\n",
       "      <td>5.00</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>Zeitgeist: Moving Forward (2011)</td>\n",
       "      <td>5.0</td>\n",
       "      <td>318</td>\n",
       "      <td>Documentary</td>\n",
       "      <td>5.00</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>Adventures Of Sherlock Holmes And Dr. Watson: ...</td>\n",
       "      <td>5.0</td>\n",
       "      <td>105</td>\n",
       "      <td>Crime|Mystery</td>\n",
       "      <td>5.00</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>Supercop 2 (Project S) (Chao ji ji hua) (1993)</td>\n",
       "      <td>5.0</td>\n",
       "      <td>493</td>\n",
       "      <td>Action|Comedy|Crime|Thriller</td>\n",
       "      <td>5.00</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>61* (2001)</td>\n",
       "      <td>5.0</td>\n",
       "      <td>585</td>\n",
       "      <td>Drama</td>\n",
       "      <td>5.00</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>Palindromes (2004)</td>\n",
       "      <td>5.0</td>\n",
       "      <td>187</td>\n",
       "      <td>Adventure|Comedy|Drama</td>\n",
       "      <td>5.00</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>Valet, The (La doublure) (2006)</td>\n",
       "      <td>5.0</td>\n",
       "      <td>89</td>\n",
       "      <td>Comedy</td>\n",
       "      <td>5.00</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22</th>\n",
       "      <td>Scooby-Doo! Abracadabra-Doo (2010)</td>\n",
       "      <td>5.0</td>\n",
       "      <td>89</td>\n",
       "      <td>Animation|Children|Mystery</td>\n",
       "      <td>5.00</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>Indignation (2016)</td>\n",
       "      <td>5.0</td>\n",
       "      <td>462</td>\n",
       "      <td>Drama</td>\n",
       "      <td>5.00</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24</th>\n",
       "      <td>The Big Bus (1976)</td>\n",
       "      <td>5.0</td>\n",
       "      <td>448</td>\n",
       "      <td>Action|Comedy</td>\n",
       "      <td>5.00</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25</th>\n",
       "      <td>Laggies (2014)</td>\n",
       "      <td>5.0</td>\n",
       "      <td>598</td>\n",
       "      <td>Comedy|Romance</td>\n",
       "      <td>5.00</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26</th>\n",
       "      <td>Investigation Held by Kolobki (1986)</td>\n",
       "      <td>5.0</td>\n",
       "      <td>105</td>\n",
       "      <td>Animation</td>\n",
       "      <td>5.00</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27</th>\n",
       "      <td>Nasu: Summer in Andalusia (2003)</td>\n",
       "      <td>5.0</td>\n",
       "      <td>318</td>\n",
       "      <td>Animation</td>\n",
       "      <td>5.00</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>28</th>\n",
       "      <td>Five Senses, The (1999)</td>\n",
       "      <td>5.0</td>\n",
       "      <td>108</td>\n",
       "      <td>Drama</td>\n",
       "      <td>5.00</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>29</th>\n",
       "      <td>The Fox and the Hound 2 (2006)</td>\n",
       "      <td>5.0</td>\n",
       "      <td>89</td>\n",
       "      <td>Adventure|Animation|Children|Comedy</td>\n",
       "      <td>5.00</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>354</th>\n",
       "      <td>Three Billboards Outside Ebbing, Missouri (2017)</td>\n",
       "      <td>5.0</td>\n",
       "      <td>338</td>\n",
       "      <td>Crime|Drama</td>\n",
       "      <td>4.75</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>355</th>\n",
       "      <td>Three Billboards Outside Ebbing, Missouri (2017)</td>\n",
       "      <td>4.5</td>\n",
       "      <td>414</td>\n",
       "      <td>Crime|Drama</td>\n",
       "      <td>4.75</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>356</th>\n",
       "      <td>Whiplash (2013)</td>\n",
       "      <td>4.5</td>\n",
       "      <td>414</td>\n",
       "      <td>(no genres listed)</td>\n",
       "      <td>4.75</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>357</th>\n",
       "      <td>Whiplash (2013)</td>\n",
       "      <td>5.0</td>\n",
       "      <td>601</td>\n",
       "      <td>(no genres listed)</td>\n",
       "      <td>4.75</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>358</th>\n",
       "      <td>Victory (a.k.a. Escape to Victory) (1981)</td>\n",
       "      <td>5.0</td>\n",
       "      <td>448</td>\n",
       "      <td>Action|Drama|War</td>\n",
       "      <td>4.75</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>359</th>\n",
       "      <td>Victory (a.k.a. Escape to Victory) (1981)</td>\n",
       "      <td>4.5</td>\n",
       "      <td>606</td>\n",
       "      <td>Action|Drama|War</td>\n",
       "      <td>4.75</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>360</th>\n",
       "      <td>Affair of Love, An (Liaison pornographique, Un...</td>\n",
       "      <td>5.0</td>\n",
       "      <td>410</td>\n",
       "      <td>Drama|Romance</td>\n",
       "      <td>4.75</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>361</th>\n",
       "      <td>Affair of Love, An (Liaison pornographique, Un...</td>\n",
       "      <td>4.5</td>\n",
       "      <td>606</td>\n",
       "      <td>Drama|Romance</td>\n",
       "      <td>4.75</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>362</th>\n",
       "      <td>Happy Together (a.k.a. Buenos Aires Affair) (C...</td>\n",
       "      <td>5.0</td>\n",
       "      <td>246</td>\n",
       "      <td>Drama|Romance</td>\n",
       "      <td>4.75</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>363</th>\n",
       "      <td>Happy Together (a.k.a. Buenos Aires Affair) (C...</td>\n",
       "      <td>4.5</td>\n",
       "      <td>606</td>\n",
       "      <td>Drama|Romance</td>\n",
       "      <td>4.75</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>364</th>\n",
       "      <td>Adam's Rib (1949)</td>\n",
       "      <td>5.0</td>\n",
       "      <td>177</td>\n",
       "      <td>Comedy|Romance</td>\n",
       "      <td>4.75</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>365</th>\n",
       "      <td>Adam's Rib (1949)</td>\n",
       "      <td>5.0</td>\n",
       "      <td>345</td>\n",
       "      <td>Comedy|Romance</td>\n",
       "      <td>4.75</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>366</th>\n",
       "      <td>Adam's Rib (1949)</td>\n",
       "      <td>5.0</td>\n",
       "      <td>474</td>\n",
       "      <td>Comedy|Romance</td>\n",
       "      <td>4.75</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>367</th>\n",
       "      <td>Adam's Rib (1949)</td>\n",
       "      <td>4.0</td>\n",
       "      <td>606</td>\n",
       "      <td>Comedy|Romance</td>\n",
       "      <td>4.75</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>368</th>\n",
       "      <td>Beautiful People (1999)</td>\n",
       "      <td>5.0</td>\n",
       "      <td>275</td>\n",
       "      <td>Comedy</td>\n",
       "      <td>4.75</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>369</th>\n",
       "      <td>Beautiful People (1999)</td>\n",
       "      <td>4.5</td>\n",
       "      <td>606</td>\n",
       "      <td>Comedy</td>\n",
       "      <td>4.75</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>370</th>\n",
       "      <td>Rififi (Du rififi chez les hommes) (1955)</td>\n",
       "      <td>4.5</td>\n",
       "      <td>387</td>\n",
       "      <td>Crime|Film-Noir|Thriller</td>\n",
       "      <td>4.75</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>371</th>\n",
       "      <td>Rififi (Du rififi chez les hommes) (1955)</td>\n",
       "      <td>5.0</td>\n",
       "      <td>391</td>\n",
       "      <td>Crime|Film-Noir|Thriller</td>\n",
       "      <td>4.75</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>372</th>\n",
       "      <td>Reefer Madness: The Movie Musical (2005)</td>\n",
       "      <td>5.0</td>\n",
       "      <td>356</td>\n",
       "      <td>Comedy|Drama|Musical</td>\n",
       "      <td>4.75</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>373</th>\n",
       "      <td>Reefer Madness: The Movie Musical (2005)</td>\n",
       "      <td>4.5</td>\n",
       "      <td>538</td>\n",
       "      <td>Comedy|Drama|Musical</td>\n",
       "      <td>4.75</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>374</th>\n",
       "      <td>Journey to the West: Conquering the Demons (Da...</td>\n",
       "      <td>4.5</td>\n",
       "      <td>125</td>\n",
       "      <td>Adventure|Comedy|Fantasy|Romance|IMAX</td>\n",
       "      <td>4.75</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>375</th>\n",
       "      <td>Journey to the West: Conquering the Demons (Da...</td>\n",
       "      <td>5.0</td>\n",
       "      <td>408</td>\n",
       "      <td>Adventure|Comedy|Fantasy|Romance|IMAX</td>\n",
       "      <td>4.75</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>376</th>\n",
       "      <td>Woman in the Dunes (Suna no onna) (1964)</td>\n",
       "      <td>5.0</td>\n",
       "      <td>156</td>\n",
       "      <td>Drama</td>\n",
       "      <td>4.75</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>377</th>\n",
       "      <td>Woman in the Dunes (Suna no onna) (1964)</td>\n",
       "      <td>4.0</td>\n",
       "      <td>318</td>\n",
       "      <td>Drama</td>\n",
       "      <td>4.75</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>378</th>\n",
       "      <td>Woman in the Dunes (Suna no onna) (1964)</td>\n",
       "      <td>5.0</td>\n",
       "      <td>410</td>\n",
       "      <td>Drama</td>\n",
       "      <td>4.75</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>379</th>\n",
       "      <td>Woman in the Dunes (Suna no onna) (1964)</td>\n",
       "      <td>5.0</td>\n",
       "      <td>603</td>\n",
       "      <td>Drama</td>\n",
       "      <td>4.75</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>380</th>\n",
       "      <td>Gentlemen of Fortune (Dzhentlmeny udachi) (1972)</td>\n",
       "      <td>4.5</td>\n",
       "      <td>105</td>\n",
       "      <td>Comedy|Crime|Drama|Mystery</td>\n",
       "      <td>4.75</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>381</th>\n",
       "      <td>Gentlemen of Fortune (Dzhentlmeny udachi) (1972)</td>\n",
       "      <td>5.0</td>\n",
       "      <td>464</td>\n",
       "      <td>Comedy|Crime|Drama|Mystery</td>\n",
       "      <td>4.75</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>382</th>\n",
       "      <td>World of Apu, The (Apur Sansar) (1959)</td>\n",
       "      <td>5.0</td>\n",
       "      <td>410</td>\n",
       "      <td>Drama</td>\n",
       "      <td>4.75</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>383</th>\n",
       "      <td>World of Apu, The (Apur Sansar) (1959)</td>\n",
       "      <td>4.5</td>\n",
       "      <td>474</td>\n",
       "      <td>Drama</td>\n",
       "      <td>4.75</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>384 rows × 6 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                                                 title  rating  userID  \\\n",
       "0                     Awfully Big Adventure, An (1995)     5.0     191   \n",
       "1                          What Happened Was... (1994)     5.0     191   \n",
       "2                               Strictly Sexual (2008)     5.0      68   \n",
       "3                                  The Love Bug (1997)     5.0      89   \n",
       "4                              Raise Your Voice (2004)     5.0     175   \n",
       "5                               One I Love, The (2014)     5.0     598   \n",
       "6                                    The Editor (2015)     5.0      89   \n",
       "7                          Tenchi Muyô! In Love (1996)     5.0      89   \n",
       "8               Martin Lawrence Live: Runteldat (2002)     5.0     553   \n",
       "9                       Who Killed Chea Vichea? (2010)     5.0     462   \n",
       "10                                      Empties (2007)     5.0     105   \n",
       "11                                     Lamerica (1994)     5.0      85   \n",
       "12                                     Lamerica (1994)     5.0     603   \n",
       "13       Passenger, The (Professione: reporter) (1975)     5.0      74   \n",
       "14                           Tales of Manhattan (1942)     5.0      89   \n",
       "15                              Denise Calls Up (1995)     5.0     555   \n",
       "16                    Zeitgeist: Moving Forward (2011)     5.0     318   \n",
       "17   Adventures Of Sherlock Holmes And Dr. Watson: ...     5.0     105   \n",
       "18      Supercop 2 (Project S) (Chao ji ji hua) (1993)     5.0     493   \n",
       "19                                          61* (2001)     5.0     585   \n",
       "20                                  Palindromes (2004)     5.0     187   \n",
       "21                     Valet, The (La doublure) (2006)     5.0      89   \n",
       "22                  Scooby-Doo! Abracadabra-Doo (2010)     5.0      89   \n",
       "23                                  Indignation (2016)     5.0     462   \n",
       "24                                  The Big Bus (1976)     5.0     448   \n",
       "25                                      Laggies (2014)     5.0     598   \n",
       "26                Investigation Held by Kolobki (1986)     5.0     105   \n",
       "27                    Nasu: Summer in Andalusia (2003)     5.0     318   \n",
       "28                             Five Senses, The (1999)     5.0     108   \n",
       "29                      The Fox and the Hound 2 (2006)     5.0      89   \n",
       "..                                                 ...     ...     ...   \n",
       "354   Three Billboards Outside Ebbing, Missouri (2017)     5.0     338   \n",
       "355   Three Billboards Outside Ebbing, Missouri (2017)     4.5     414   \n",
       "356                                    Whiplash (2013)     4.5     414   \n",
       "357                                    Whiplash (2013)     5.0     601   \n",
       "358          Victory (a.k.a. Escape to Victory) (1981)     5.0     448   \n",
       "359          Victory (a.k.a. Escape to Victory) (1981)     4.5     606   \n",
       "360  Affair of Love, An (Liaison pornographique, Un...     5.0     410   \n",
       "361  Affair of Love, An (Liaison pornographique, Un...     4.5     606   \n",
       "362  Happy Together (a.k.a. Buenos Aires Affair) (C...     5.0     246   \n",
       "363  Happy Together (a.k.a. Buenos Aires Affair) (C...     4.5     606   \n",
       "364                                  Adam's Rib (1949)     5.0     177   \n",
       "365                                  Adam's Rib (1949)     5.0     345   \n",
       "366                                  Adam's Rib (1949)     5.0     474   \n",
       "367                                  Adam's Rib (1949)     4.0     606   \n",
       "368                            Beautiful People (1999)     5.0     275   \n",
       "369                            Beautiful People (1999)     4.5     606   \n",
       "370          Rififi (Du rififi chez les hommes) (1955)     4.5     387   \n",
       "371          Rififi (Du rififi chez les hommes) (1955)     5.0     391   \n",
       "372           Reefer Madness: The Movie Musical (2005)     5.0     356   \n",
       "373           Reefer Madness: The Movie Musical (2005)     4.5     538   \n",
       "374  Journey to the West: Conquering the Demons (Da...     4.5     125   \n",
       "375  Journey to the West: Conquering the Demons (Da...     5.0     408   \n",
       "376           Woman in the Dunes (Suna no onna) (1964)     5.0     156   \n",
       "377           Woman in the Dunes (Suna no onna) (1964)     4.0     318   \n",
       "378           Woman in the Dunes (Suna no onna) (1964)     5.0     410   \n",
       "379           Woman in the Dunes (Suna no onna) (1964)     5.0     603   \n",
       "380   Gentlemen of Fortune (Dzhentlmeny udachi) (1972)     4.5     105   \n",
       "381   Gentlemen of Fortune (Dzhentlmeny udachi) (1972)     5.0     464   \n",
       "382             World of Apu, The (Apur Sansar) (1959)     5.0     410   \n",
       "383             World of Apu, The (Apur Sansar) (1959)     4.5     474   \n",
       "\n",
       "                                    genres  avg_movie_rating  rank  \n",
       "0                                    Drama              5.00     1  \n",
       "1            Comedy|Drama|Romance|Thriller              5.00     1  \n",
       "2                     Comedy|Drama|Romance              5.00     1  \n",
       "3        Adventure|Children|Comedy|Fantasy              5.00     1  \n",
       "4                                  Romance              5.00     1  \n",
       "5                     Comedy|Drama|Romance              5.00     1  \n",
       "6                    Comedy|Horror|Mystery              5.00     1  \n",
       "7                         Animation|Comedy              5.00     1  \n",
       "8                       Comedy|Documentary              5.00     1  \n",
       "9                              Documentary              5.00     1  \n",
       "10                                  Comedy              5.00     1  \n",
       "11                         Adventure|Drama              5.00     1  \n",
       "12                         Adventure|Drama              5.00     1  \n",
       "13                                   Drama              5.00     1  \n",
       "14                            Comedy|Drama              5.00     1  \n",
       "15                                  Comedy              5.00     1  \n",
       "16                             Documentary              5.00     1  \n",
       "17                           Crime|Mystery              5.00     1  \n",
       "18            Action|Comedy|Crime|Thriller              5.00     1  \n",
       "19                                   Drama              5.00     1  \n",
       "20                  Adventure|Comedy|Drama              5.00     1  \n",
       "21                                  Comedy              5.00     1  \n",
       "22              Animation|Children|Mystery              5.00     1  \n",
       "23                                   Drama              5.00     1  \n",
       "24                           Action|Comedy              5.00     1  \n",
       "25                          Comedy|Romance              5.00     1  \n",
       "26                               Animation              5.00     1  \n",
       "27                               Animation              5.00     1  \n",
       "28                                   Drama              5.00     1  \n",
       "29     Adventure|Animation|Children|Comedy              5.00     1  \n",
       "..                                     ...               ...   ...  \n",
       "354                            Crime|Drama              4.75     4  \n",
       "355                            Crime|Drama              4.75     4  \n",
       "356                     (no genres listed)              4.75     4  \n",
       "357                     (no genres listed)              4.75     4  \n",
       "358                       Action|Drama|War              4.75     4  \n",
       "359                       Action|Drama|War              4.75     4  \n",
       "360                          Drama|Romance              4.75     4  \n",
       "361                          Drama|Romance              4.75     4  \n",
       "362                          Drama|Romance              4.75     4  \n",
       "363                          Drama|Romance              4.75     4  \n",
       "364                         Comedy|Romance              4.75     4  \n",
       "365                         Comedy|Romance              4.75     4  \n",
       "366                         Comedy|Romance              4.75     4  \n",
       "367                         Comedy|Romance              4.75     4  \n",
       "368                                 Comedy              4.75     4  \n",
       "369                                 Comedy              4.75     4  \n",
       "370               Crime|Film-Noir|Thriller              4.75     4  \n",
       "371               Crime|Film-Noir|Thriller              4.75     4  \n",
       "372                   Comedy|Drama|Musical              4.75     4  \n",
       "373                   Comedy|Drama|Musical              4.75     4  \n",
       "374  Adventure|Comedy|Fantasy|Romance|IMAX              4.75     4  \n",
       "375  Adventure|Comedy|Fantasy|Romance|IMAX              4.75     4  \n",
       "376                                  Drama              4.75     4  \n",
       "377                                  Drama              4.75     4  \n",
       "378                                  Drama              4.75     4  \n",
       "379                                  Drama              4.75     4  \n",
       "380             Comedy|Crime|Drama|Mystery              4.75     4  \n",
       "381             Comedy|Crime|Drama|Mystery              4.75     4  \n",
       "382                                  Drama              4.75     4  \n",
       "383                                  Drama              4.75     4  \n",
       "\n",
       "[384 rows x 6 columns]"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "pd_rank"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>title</th>\n",
       "      <th>rating</th>\n",
       "      <th>userID</th>\n",
       "      <th>genres</th>\n",
       "      <th>avg_movie_rating</th>\n",
       "      <th>rank</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Awfully Big Adventure, An (1995)</td>\n",
       "      <td>5.0</td>\n",
       "      <td>191</td>\n",
       "      <td>Drama</td>\n",
       "      <td>5.000000</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>What Happened Was... (1994)</td>\n",
       "      <td>5.0</td>\n",
       "      <td>191</td>\n",
       "      <td>Comedy|Drama|Romance|Thriller</td>\n",
       "      <td>5.000000</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Strictly Sexual (2008)</td>\n",
       "      <td>5.0</td>\n",
       "      <td>68</td>\n",
       "      <td>Comedy|Drama|Romance</td>\n",
       "      <td>5.000000</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>The Love Bug (1997)</td>\n",
       "      <td>5.0</td>\n",
       "      <td>89</td>\n",
       "      <td>Adventure|Children|Comedy|Fantasy</td>\n",
       "      <td>5.000000</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>Raise Your Voice (2004)</td>\n",
       "      <td>5.0</td>\n",
       "      <td>175</td>\n",
       "      <td>Romance</td>\n",
       "      <td>5.000000</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>One I Love, The (2014)</td>\n",
       "      <td>5.0</td>\n",
       "      <td>598</td>\n",
       "      <td>Comedy|Drama|Romance</td>\n",
       "      <td>5.000000</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>The Editor (2015)</td>\n",
       "      <td>5.0</td>\n",
       "      <td>89</td>\n",
       "      <td>Comedy|Horror|Mystery</td>\n",
       "      <td>5.000000</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>Tenchi Muyô! In Love (1996)</td>\n",
       "      <td>5.0</td>\n",
       "      <td>89</td>\n",
       "      <td>Animation|Comedy</td>\n",
       "      <td>5.000000</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>Martin Lawrence Live: Runteldat (2002)</td>\n",
       "      <td>5.0</td>\n",
       "      <td>553</td>\n",
       "      <td>Comedy|Documentary</td>\n",
       "      <td>5.000000</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>Who Killed Chea Vichea? (2010)</td>\n",
       "      <td>5.0</td>\n",
       "      <td>462</td>\n",
       "      <td>Documentary</td>\n",
       "      <td>5.000000</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>Empties (2007)</td>\n",
       "      <td>5.0</td>\n",
       "      <td>105</td>\n",
       "      <td>Comedy</td>\n",
       "      <td>5.000000</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>Lamerica (1994)</td>\n",
       "      <td>5.0</td>\n",
       "      <td>85</td>\n",
       "      <td>Adventure|Drama</td>\n",
       "      <td>5.000000</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>Passenger, The (Professione: reporter) (1975)</td>\n",
       "      <td>5.0</td>\n",
       "      <td>74</td>\n",
       "      <td>Drama</td>\n",
       "      <td>5.000000</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>Tales of Manhattan (1942)</td>\n",
       "      <td>5.0</td>\n",
       "      <td>89</td>\n",
       "      <td>Comedy|Drama</td>\n",
       "      <td>5.000000</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>Denise Calls Up (1995)</td>\n",
       "      <td>5.0</td>\n",
       "      <td>555</td>\n",
       "      <td>Comedy</td>\n",
       "      <td>5.000000</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>Zeitgeist: Moving Forward (2011)</td>\n",
       "      <td>5.0</td>\n",
       "      <td>318</td>\n",
       "      <td>Documentary</td>\n",
       "      <td>5.000000</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>Adventures Of Sherlock Holmes And Dr. Watson: ...</td>\n",
       "      <td>5.0</td>\n",
       "      <td>105</td>\n",
       "      <td>Crime|Mystery</td>\n",
       "      <td>5.000000</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>Supercop 2 (Project S) (Chao ji ji hua) (1993)</td>\n",
       "      <td>5.0</td>\n",
       "      <td>493</td>\n",
       "      <td>Action|Comedy|Crime|Thriller</td>\n",
       "      <td>5.000000</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>61* (2001)</td>\n",
       "      <td>5.0</td>\n",
       "      <td>585</td>\n",
       "      <td>Drama</td>\n",
       "      <td>5.000000</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>Palindromes (2004)</td>\n",
       "      <td>5.0</td>\n",
       "      <td>187</td>\n",
       "      <td>Adventure|Comedy|Drama</td>\n",
       "      <td>5.000000</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>Valet, The (La doublure) (2006)</td>\n",
       "      <td>5.0</td>\n",
       "      <td>89</td>\n",
       "      <td>Comedy</td>\n",
       "      <td>5.000000</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22</th>\n",
       "      <td>Scooby-Doo! Abracadabra-Doo (2010)</td>\n",
       "      <td>5.0</td>\n",
       "      <td>89</td>\n",
       "      <td>Animation|Children|Mystery</td>\n",
       "      <td>5.000000</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>Indignation (2016)</td>\n",
       "      <td>5.0</td>\n",
       "      <td>462</td>\n",
       "      <td>Drama</td>\n",
       "      <td>5.000000</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24</th>\n",
       "      <td>The Big Bus (1976)</td>\n",
       "      <td>5.0</td>\n",
       "      <td>448</td>\n",
       "      <td>Action|Comedy</td>\n",
       "      <td>5.000000</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25</th>\n",
       "      <td>Laggies (2014)</td>\n",
       "      <td>5.0</td>\n",
       "      <td>598</td>\n",
       "      <td>Comedy|Romance</td>\n",
       "      <td>5.000000</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26</th>\n",
       "      <td>Investigation Held by Kolobki (1986)</td>\n",
       "      <td>5.0</td>\n",
       "      <td>105</td>\n",
       "      <td>Animation</td>\n",
       "      <td>5.000000</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27</th>\n",
       "      <td>Nasu: Summer in Andalusia (2003)</td>\n",
       "      <td>5.0</td>\n",
       "      <td>318</td>\n",
       "      <td>Animation</td>\n",
       "      <td>5.000000</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>28</th>\n",
       "      <td>Five Senses, The (1999)</td>\n",
       "      <td>5.0</td>\n",
       "      <td>108</td>\n",
       "      <td>Drama</td>\n",
       "      <td>5.000000</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>29</th>\n",
       "      <td>The Fox and the Hound 2 (2006)</td>\n",
       "      <td>5.0</td>\n",
       "      <td>89</td>\n",
       "      <td>Adventure|Animation|Children|Comedy</td>\n",
       "      <td>5.000000</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>30</th>\n",
       "      <td>The Bremen Town Musicians (1969)</td>\n",
       "      <td>5.0</td>\n",
       "      <td>105</td>\n",
       "      <td>Animation|Drama|Fantasy</td>\n",
       "      <td>5.000000</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>311</th>\n",
       "      <td>Bad Boy Bubby (1993)</td>\n",
       "      <td>5.0</td>\n",
       "      <td>405</td>\n",
       "      <td>Drama</td>\n",
       "      <td>4.833333</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>314</th>\n",
       "      <td>Gozu (Gokudô kyôfu dai-gekijô: Gozu) (2003)</td>\n",
       "      <td>4.5</td>\n",
       "      <td>274</td>\n",
       "      <td>Comedy|Crime|Drama|Horror|Mystery</td>\n",
       "      <td>4.750000</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>316</th>\n",
       "      <td>The Blue Planet (2001)</td>\n",
       "      <td>5.0</td>\n",
       "      <td>251</td>\n",
       "      <td>Documentary</td>\n",
       "      <td>4.750000</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>318</th>\n",
       "      <td>Awful Truth, The (1937)</td>\n",
       "      <td>5.0</td>\n",
       "      <td>275</td>\n",
       "      <td>Comedy|Romance</td>\n",
       "      <td>4.750000</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>320</th>\n",
       "      <td>Anne of Green Gables: The Sequel (a.k.a. Anne ...</td>\n",
       "      <td>5.0</td>\n",
       "      <td>357</td>\n",
       "      <td>Children|Drama|Romance</td>\n",
       "      <td>4.750000</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>322</th>\n",
       "      <td>The Godfather Trilogy: 1972-1990 (1992)</td>\n",
       "      <td>5.0</td>\n",
       "      <td>62</td>\n",
       "      <td>(no genres listed)</td>\n",
       "      <td>4.750000</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>324</th>\n",
       "      <td>Dead Man's Shoes (2004)</td>\n",
       "      <td>4.5</td>\n",
       "      <td>351</td>\n",
       "      <td>Crime|Thriller</td>\n",
       "      <td>4.750000</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>326</th>\n",
       "      <td>Doctor Who: A Christmas Carol (2010)</td>\n",
       "      <td>4.5</td>\n",
       "      <td>210</td>\n",
       "      <td>Sci-Fi</td>\n",
       "      <td>4.750000</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>328</th>\n",
       "      <td>3 Idiots (2009)</td>\n",
       "      <td>4.5</td>\n",
       "      <td>105</td>\n",
       "      <td>Comedy|Drama|Romance</td>\n",
       "      <td>4.750000</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>330</th>\n",
       "      <td>Wild Parrots of Telegraph Hill, The (2003)</td>\n",
       "      <td>5.0</td>\n",
       "      <td>462</td>\n",
       "      <td>Documentary</td>\n",
       "      <td>4.750000</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>332</th>\n",
       "      <td>Sherlock - A Study in Pink (2010)</td>\n",
       "      <td>4.5</td>\n",
       "      <td>18</td>\n",
       "      <td>Crime</td>\n",
       "      <td>4.750000</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>334</th>\n",
       "      <td>My Dinner with André (1981)</td>\n",
       "      <td>4.5</td>\n",
       "      <td>182</td>\n",
       "      <td>Drama</td>\n",
       "      <td>4.750000</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>336</th>\n",
       "      <td>The Pacific (2010)</td>\n",
       "      <td>5.0</td>\n",
       "      <td>105</td>\n",
       "      <td>Action|Adventure|Drama|War</td>\n",
       "      <td>4.750000</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>338</th>\n",
       "      <td>Best of Youth, The (La meglio gioventù) (2003)</td>\n",
       "      <td>4.5</td>\n",
       "      <td>462</td>\n",
       "      <td>Drama</td>\n",
       "      <td>4.750000</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>340</th>\n",
       "      <td>Hunger (2008)</td>\n",
       "      <td>4.5</td>\n",
       "      <td>18</td>\n",
       "      <td>Drama</td>\n",
       "      <td>4.750000</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>342</th>\n",
       "      <td>Imposter, The (2012)</td>\n",
       "      <td>5.0</td>\n",
       "      <td>419</td>\n",
       "      <td>Documentary</td>\n",
       "      <td>4.750000</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>344</th>\n",
       "      <td>Black Mirror: White Christmas (2014)</td>\n",
       "      <td>5.0</td>\n",
       "      <td>62</td>\n",
       "      <td>Drama|Horror|Mystery|Sci-Fi|Thriller</td>\n",
       "      <td>4.750000</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>348</th>\n",
       "      <td>Three Billboards Outside Ebbing, Missouri (2017)</td>\n",
       "      <td>4.5</td>\n",
       "      <td>18</td>\n",
       "      <td>Crime|Drama</td>\n",
       "      <td>4.750000</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>356</th>\n",
       "      <td>Whiplash (2013)</td>\n",
       "      <td>4.5</td>\n",
       "      <td>414</td>\n",
       "      <td>(no genres listed)</td>\n",
       "      <td>4.750000</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>358</th>\n",
       "      <td>Victory (a.k.a. Escape to Victory) (1981)</td>\n",
       "      <td>5.0</td>\n",
       "      <td>448</td>\n",
       "      <td>Action|Drama|War</td>\n",
       "      <td>4.750000</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>360</th>\n",
       "      <td>Affair of Love, An (Liaison pornographique, Un...</td>\n",
       "      <td>5.0</td>\n",
       "      <td>410</td>\n",
       "      <td>Drama|Romance</td>\n",
       "      <td>4.750000</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>362</th>\n",
       "      <td>Happy Together (a.k.a. Buenos Aires Affair) (C...</td>\n",
       "      <td>5.0</td>\n",
       "      <td>246</td>\n",
       "      <td>Drama|Romance</td>\n",
       "      <td>4.750000</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>364</th>\n",
       "      <td>Adam's Rib (1949)</td>\n",
       "      <td>5.0</td>\n",
       "      <td>177</td>\n",
       "      <td>Comedy|Romance</td>\n",
       "      <td>4.750000</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>368</th>\n",
       "      <td>Beautiful People (1999)</td>\n",
       "      <td>5.0</td>\n",
       "      <td>275</td>\n",
       "      <td>Comedy</td>\n",
       "      <td>4.750000</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>370</th>\n",
       "      <td>Rififi (Du rififi chez les hommes) (1955)</td>\n",
       "      <td>4.5</td>\n",
       "      <td>387</td>\n",
       "      <td>Crime|Film-Noir|Thriller</td>\n",
       "      <td>4.750000</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>372</th>\n",
       "      <td>Reefer Madness: The Movie Musical (2005)</td>\n",
       "      <td>5.0</td>\n",
       "      <td>356</td>\n",
       "      <td>Comedy|Drama|Musical</td>\n",
       "      <td>4.750000</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>374</th>\n",
       "      <td>Journey to the West: Conquering the Demons (Da...</td>\n",
       "      <td>4.5</td>\n",
       "      <td>125</td>\n",
       "      <td>Adventure|Comedy|Fantasy|Romance|IMAX</td>\n",
       "      <td>4.750000</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>376</th>\n",
       "      <td>Woman in the Dunes (Suna no onna) (1964)</td>\n",
       "      <td>5.0</td>\n",
       "      <td>156</td>\n",
       "      <td>Drama</td>\n",
       "      <td>4.750000</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>380</th>\n",
       "      <td>Gentlemen of Fortune (Dzhentlmeny udachi) (1972)</td>\n",
       "      <td>4.5</td>\n",
       "      <td>105</td>\n",
       "      <td>Comedy|Crime|Drama|Mystery</td>\n",
       "      <td>4.750000</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>382</th>\n",
       "      <td>World of Apu, The (Apur Sansar) (1959)</td>\n",
       "      <td>5.0</td>\n",
       "      <td>410</td>\n",
       "      <td>Drama</td>\n",
       "      <td>4.750000</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>328 rows × 6 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                                                 title  rating  userID  \\\n",
       "0                     Awfully Big Adventure, An (1995)     5.0     191   \n",
       "1                          What Happened Was... (1994)     5.0     191   \n",
       "2                               Strictly Sexual (2008)     5.0      68   \n",
       "3                                  The Love Bug (1997)     5.0      89   \n",
       "4                              Raise Your Voice (2004)     5.0     175   \n",
       "5                               One I Love, The (2014)     5.0     598   \n",
       "6                                    The Editor (2015)     5.0      89   \n",
       "7                          Tenchi Muyô! In Love (1996)     5.0      89   \n",
       "8               Martin Lawrence Live: Runteldat (2002)     5.0     553   \n",
       "9                       Who Killed Chea Vichea? (2010)     5.0     462   \n",
       "10                                      Empties (2007)     5.0     105   \n",
       "11                                     Lamerica (1994)     5.0      85   \n",
       "13       Passenger, The (Professione: reporter) (1975)     5.0      74   \n",
       "14                           Tales of Manhattan (1942)     5.0      89   \n",
       "15                              Denise Calls Up (1995)     5.0     555   \n",
       "16                    Zeitgeist: Moving Forward (2011)     5.0     318   \n",
       "17   Adventures Of Sherlock Holmes And Dr. Watson: ...     5.0     105   \n",
       "18      Supercop 2 (Project S) (Chao ji ji hua) (1993)     5.0     493   \n",
       "19                                          61* (2001)     5.0     585   \n",
       "20                                  Palindromes (2004)     5.0     187   \n",
       "21                     Valet, The (La doublure) (2006)     5.0      89   \n",
       "22                  Scooby-Doo! Abracadabra-Doo (2010)     5.0      89   \n",
       "23                                  Indignation (2016)     5.0     462   \n",
       "24                                  The Big Bus (1976)     5.0     448   \n",
       "25                                      Laggies (2014)     5.0     598   \n",
       "26                Investigation Held by Kolobki (1986)     5.0     105   \n",
       "27                    Nasu: Summer in Andalusia (2003)     5.0     318   \n",
       "28                             Five Senses, The (1999)     5.0     108   \n",
       "29                      The Fox and the Hound 2 (2006)     5.0      89   \n",
       "30                    The Bremen Town Musicians (1969)     5.0     105   \n",
       "..                                                 ...     ...     ...   \n",
       "311                               Bad Boy Bubby (1993)     5.0     405   \n",
       "314        Gozu (Gokudô kyôfu dai-gekijô: Gozu) (2003)     4.5     274   \n",
       "316                             The Blue Planet (2001)     5.0     251   \n",
       "318                            Awful Truth, The (1937)     5.0     275   \n",
       "320  Anne of Green Gables: The Sequel (a.k.a. Anne ...     5.0     357   \n",
       "322            The Godfather Trilogy: 1972-1990 (1992)     5.0      62   \n",
       "324                            Dead Man's Shoes (2004)     4.5     351   \n",
       "326               Doctor Who: A Christmas Carol (2010)     4.5     210   \n",
       "328                                    3 Idiots (2009)     4.5     105   \n",
       "330         Wild Parrots of Telegraph Hill, The (2003)     5.0     462   \n",
       "332                  Sherlock - A Study in Pink (2010)     4.5      18   \n",
       "334                        My Dinner with André (1981)     4.5     182   \n",
       "336                                 The Pacific (2010)     5.0     105   \n",
       "338     Best of Youth, The (La meglio gioventù) (2003)     4.5     462   \n",
       "340                                      Hunger (2008)     4.5      18   \n",
       "342                               Imposter, The (2012)     5.0     419   \n",
       "344               Black Mirror: White Christmas (2014)     5.0      62   \n",
       "348   Three Billboards Outside Ebbing, Missouri (2017)     4.5      18   \n",
       "356                                    Whiplash (2013)     4.5     414   \n",
       "358          Victory (a.k.a. Escape to Victory) (1981)     5.0     448   \n",
       "360  Affair of Love, An (Liaison pornographique, Un...     5.0     410   \n",
       "362  Happy Together (a.k.a. Buenos Aires Affair) (C...     5.0     246   \n",
       "364                                  Adam's Rib (1949)     5.0     177   \n",
       "368                            Beautiful People (1999)     5.0     275   \n",
       "370          Rififi (Du rififi chez les hommes) (1955)     4.5     387   \n",
       "372           Reefer Madness: The Movie Musical (2005)     5.0     356   \n",
       "374  Journey to the West: Conquering the Demons (Da...     4.5     125   \n",
       "376           Woman in the Dunes (Suna no onna) (1964)     5.0     156   \n",
       "380   Gentlemen of Fortune (Dzhentlmeny udachi) (1972)     4.5     105   \n",
       "382             World of Apu, The (Apur Sansar) (1959)     5.0     410   \n",
       "\n",
       "                                    genres  avg_movie_rating  rank  \n",
       "0                                    Drama          5.000000     1  \n",
       "1            Comedy|Drama|Romance|Thriller          5.000000     1  \n",
       "2                     Comedy|Drama|Romance          5.000000     1  \n",
       "3        Adventure|Children|Comedy|Fantasy          5.000000     1  \n",
       "4                                  Romance          5.000000     1  \n",
       "5                     Comedy|Drama|Romance          5.000000     1  \n",
       "6                    Comedy|Horror|Mystery          5.000000     1  \n",
       "7                         Animation|Comedy          5.000000     1  \n",
       "8                       Comedy|Documentary          5.000000     1  \n",
       "9                              Documentary          5.000000     1  \n",
       "10                                  Comedy          5.000000     1  \n",
       "11                         Adventure|Drama          5.000000     1  \n",
       "13                                   Drama          5.000000     1  \n",
       "14                            Comedy|Drama          5.000000     1  \n",
       "15                                  Comedy          5.000000     1  \n",
       "16                             Documentary          5.000000     1  \n",
       "17                           Crime|Mystery          5.000000     1  \n",
       "18            Action|Comedy|Crime|Thriller          5.000000     1  \n",
       "19                                   Drama          5.000000     1  \n",
       "20                  Adventure|Comedy|Drama          5.000000     1  \n",
       "21                                  Comedy          5.000000     1  \n",
       "22              Animation|Children|Mystery          5.000000     1  \n",
       "23                                   Drama          5.000000     1  \n",
       "24                           Action|Comedy          5.000000     1  \n",
       "25                          Comedy|Romance          5.000000     1  \n",
       "26                               Animation          5.000000     1  \n",
       "27                               Animation          5.000000     1  \n",
       "28                                   Drama          5.000000     1  \n",
       "29     Adventure|Animation|Children|Comedy          5.000000     1  \n",
       "30                 Animation|Drama|Fantasy          5.000000     1  \n",
       "..                                     ...               ...   ...  \n",
       "311                                  Drama          4.833333     3  \n",
       "314      Comedy|Crime|Drama|Horror|Mystery          4.750000     4  \n",
       "316                            Documentary          4.750000     4  \n",
       "318                         Comedy|Romance          4.750000     4  \n",
       "320                 Children|Drama|Romance          4.750000     4  \n",
       "322                     (no genres listed)          4.750000     4  \n",
       "324                         Crime|Thriller          4.750000     4  \n",
       "326                                 Sci-Fi          4.750000     4  \n",
       "328                   Comedy|Drama|Romance          4.750000     4  \n",
       "330                            Documentary          4.750000     4  \n",
       "332                                  Crime          4.750000     4  \n",
       "334                                  Drama          4.750000     4  \n",
       "336             Action|Adventure|Drama|War          4.750000     4  \n",
       "338                                  Drama          4.750000     4  \n",
       "340                                  Drama          4.750000     4  \n",
       "342                            Documentary          4.750000     4  \n",
       "344   Drama|Horror|Mystery|Sci-Fi|Thriller          4.750000     4  \n",
       "348                            Crime|Drama          4.750000     4  \n",
       "356                     (no genres listed)          4.750000     4  \n",
       "358                       Action|Drama|War          4.750000     4  \n",
       "360                          Drama|Romance          4.750000     4  \n",
       "362                          Drama|Romance          4.750000     4  \n",
       "364                         Comedy|Romance          4.750000     4  \n",
       "368                                 Comedy          4.750000     4  \n",
       "370               Crime|Film-Noir|Thriller          4.750000     4  \n",
       "372                   Comedy|Drama|Musical          4.750000     4  \n",
       "374  Adventure|Comedy|Fantasy|Romance|IMAX          4.750000     4  \n",
       "376                                  Drama          4.750000     4  \n",
       "380             Comedy|Crime|Drama|Mystery          4.750000     4  \n",
       "382                                  Drama          4.750000     4  \n",
       "\n",
       "[328 rows x 6 columns]"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "pd_rank.drop_duplicates(subset=['title'], keep='first')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0                                      Drama\n",
       "1              Comedy|Drama|Romance|Thriller\n",
       "2                       Comedy|Drama|Romance\n",
       "3          Adventure|Children|Comedy|Fantasy\n",
       "4                                    Romance\n",
       "5                       Comedy|Drama|Romance\n",
       "6                      Comedy|Horror|Mystery\n",
       "7                           Animation|Comedy\n",
       "8                         Comedy|Documentary\n",
       "9                                Documentary\n",
       "10                                    Comedy\n",
       "11                           Adventure|Drama\n",
       "12                           Adventure|Drama\n",
       "13                                     Drama\n",
       "14                              Comedy|Drama\n",
       "15                                    Comedy\n",
       "16                               Documentary\n",
       "17                             Crime|Mystery\n",
       "18              Action|Comedy|Crime|Thriller\n",
       "19                                     Drama\n",
       "20                    Adventure|Comedy|Drama\n",
       "21                                    Comedy\n",
       "22                Animation|Children|Mystery\n",
       "23                                     Drama\n",
       "24                             Action|Comedy\n",
       "25                            Comedy|Romance\n",
       "26                                 Animation\n",
       "27                                 Animation\n",
       "28                                     Drama\n",
       "29       Adventure|Animation|Children|Comedy\n",
       "                       ...                  \n",
       "354                              Crime|Drama\n",
       "355                              Crime|Drama\n",
       "356                       (no genres listed)\n",
       "357                       (no genres listed)\n",
       "358                         Action|Drama|War\n",
       "359                         Action|Drama|War\n",
       "360                            Drama|Romance\n",
       "361                            Drama|Romance\n",
       "362                            Drama|Romance\n",
       "363                            Drama|Romance\n",
       "364                           Comedy|Romance\n",
       "365                           Comedy|Romance\n",
       "366                           Comedy|Romance\n",
       "367                           Comedy|Romance\n",
       "368                                   Comedy\n",
       "369                                   Comedy\n",
       "370                 Crime|Film-Noir|Thriller\n",
       "371                 Crime|Film-Noir|Thriller\n",
       "372                     Comedy|Drama|Musical\n",
       "373                     Comedy|Drama|Musical\n",
       "374    Adventure|Comedy|Fantasy|Romance|IMAX\n",
       "375    Adventure|Comedy|Fantasy|Romance|IMAX\n",
       "376                                    Drama\n",
       "377                                    Drama\n",
       "378                                    Drama\n",
       "379                                    Drama\n",
       "380               Comedy|Crime|Drama|Mystery\n",
       "381               Comedy|Crime|Drama|Mystery\n",
       "382                                    Drama\n",
       "383                                    Drama\n",
       "Name: genres, Length: 384, dtype: object"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "pd_rank['genres']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>CategoryName</th>\n",
       "      <th>CategoryNum</th>\n",
       "      <th>OrderNum</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Seafood</td>\n",
       "      <td>12</td>\n",
       "      <td>330</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Meat/Poultry</td>\n",
       "      <td>6</td>\n",
       "      <td>173</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Condiments</td>\n",
       "      <td>12</td>\n",
       "      <td>216</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>Confections</td>\n",
       "      <td>13</td>\n",
       "      <td>334</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>Produce</td>\n",
       "      <td>5</td>\n",
       "      <td>136</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>Dairy Products</td>\n",
       "      <td>10</td>\n",
       "      <td>366</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>Beverages</td>\n",
       "      <td>12</td>\n",
       "      <td>404</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>Grains/Cereals</td>\n",
       "      <td>7</td>\n",
       "      <td>196</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "     CategoryName  CategoryNum  OrderNum\n",
       "0         Seafood           12       330\n",
       "1    Meat/Poultry            6       173\n",
       "2      Condiments           12       216\n",
       "3     Confections           13       334\n",
       "4         Produce            5       136\n",
       "5  Dairy Products           10       366\n",
       "6       Beverages           12       404\n",
       "7  Grains/Cereals            7       196"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import pandas as pd\n",
    "pd.read_csv('category.csv')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.16"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
